package com.luzh.myspring.context.support;

import com.luzh.myspring.beans.factory.support.DefaultListableBeanFactory;
import com.luzh.myspring.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * 可加载xml bean定义的应用上下文
 */
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext {

    /**
     * 创建xml加载器加载bean定义
     * @param beanFactory
     */
    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) {
        XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory, this);
        String[] configLocations = getConfigLocations();
        if (null != configLocations){
            beanDefinitionReader.loadBeanDefinitions(configLocations);
        }
    }

    protected abstract String[] getConfigLocations();

}
